package cn.liulingfengyu.behavioralpatterns.chainofresponsibilitypattern;

public class ChainOfResponsibilityPatternDemo {
    public static void main(String[] args) {
        // 创建处理者链
        Handler handlerA = new ConcreteHandlerA();
        Handler handlerB = new ConcreteHandlerB();

        handlerA.setNextHandler(handlerB);

        // 发送请求
        int[] requests = {2, 15, 5, 25, 10};

        for (int request : requests) {
            handlerA.handleRequest(request);
        }
    }
}